package com.foxmail.aroundme.youtubedemo.recyclerview;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils;
import android.util.Log;

import com.foxmail.aroundme.youtubedemo.R;
import com.foxmail.aroundme.youtubedemo.utils.RandomId;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;

import static android.text.format.DateUtils.HOUR_IN_MILLIS;
import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
import static android.text.format.DateUtils.SECOND_IN_MILLIS;

/**
 * Created by gzl on 2016/10/19.
 */

public class RecyclerViewAty extends Activity{

    private List<String> list = new ArrayList<String>();
    private RecyclerView recyclerView;
    private RecyclerViewAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.recyclerdemo);
        Random random = new Random();
        for(int i = 0 ; i < 100; i ++){
            list.add(RandomId.args[random.nextInt(100)]);
        }

        recyclerView = (RecyclerView)findViewById(R.id.recy);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.addItemDecoration(new DividerItemDecoration(this,
                DividerItemDecoration.VERTICAL_LIST));
        adapter = new RecyclerViewAdapter(RecyclerViewAty.this, list, getFragmentManager());
        recyclerView.setAdapter(adapter);
    }
}
